home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / shareware / intuition / yak_1.57 / source / memwatch.h < prev    next >
C/C++ Source or Header  |  1994-11-17  |  3KB  |  73 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  2. * |_o_o|\\ Copyright (c) 1989 The Software Distillery.                    *
  3. * |. o.| ||          All Rights Reserved                                  *
  4. * | .  | ||          Written by Doug Walker                               *
  5. * | o  | ||          The Software Distillery                              *
  6. * |  . |//           235 Trillingham Lane                                 *
  7. * ======             Cary, NC 27513                                       *
  8. *                    BBS:(919)-471-6436                                   *
  9. \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  10.  
  11. #ifndef D_MEMWATCH_H
  12. #define D_MEMWATCH_H
  13.  
  14. /* Flags for MWInit */
  15. #define MWF_NOCHECK   0x00000000 /* (compatibility - do not use)         */
  16. #define MWF_NOLOG     0x00000002 /* No debug messages                    */
  17. #define MWF_CHECK     0x00000004 /* Check mem whenever mem rtns called   */
  18. #define MWF_NOFREE    0x00000008 /* Don't free nonfreed memory           */
  19. #define MWF_NOFTRASH  0x00000010 /* Don't trash memory upon free         */
  20. #define MWF_NOATRASH  0x00000020 /* Don't trash memory upon alloc        */
  21. #define MWF_NOFKEEP   0x00000040 /* Don't keep memory after free         */
  22. #define MWF_MALLOCWRN 0x00000080 /* Warn about malloc'd mem not freed    */
  23. #define MWF_SERIAL    0x00000100 /* Use serial port for output           */
  24.  
  25. #define MWF_ACTIVE   0x80000000 /* PRIVATE - MemWatch is active          */
  26. #define MWF_ERROR    0x40000000 /* PRIVATE - Error discovered, terminate */
  27.  
  28. /* Flags to tell MWReport how much to report */
  29. #define MWR_NONE 0   /* Don't report anything; just return    */
  30. #define MWR_SUM  1   /* Report current and total usage        */
  31. #define MWR_FULL 2   /* Report on all outstanding allocations */
  32.  
  33. #if MWDEBUG
  34.  
  35. #include <exec/types.h>
  36.  
  37. #ifdef free
  38. #undef free
  39. #endif
  40.  
  41. #define AllocMem(size,flags) MWAllocMem(size, flags, 0, __FILE__, __LINE__)
  42. #define FreeMem(mem,size)    MWFreeMem(mem, size, 0, __FILE__, __LINE__)
  43. #define malloc(size)         MWAllocMem(size, 0, 1, __FILE__, __LINE__)
  44. #define calloc(nelt,esize)   MWAllocMem((nelt)*(esize), MEMF_CLEAR, 1, \
  45.                                         __FILE__, __LINE__)
  46. #define realloc(mem,size)    MWrealloc(mem,size,__FILE__,__LINE__)
  47. #define free(mem)            MWFreeMem(mem, -1, 1, __FILE__, __LINE__)
  48.  
  49. void MWInit      (LONG, LONG, char *);
  50. void MWTerm      (void);
  51. void *MWAllocMem (long, long, long, char *, long);
  52. void MWFreeMem   (void *, long, long, char *, long);
  53. void MWCheck     (void);
  54. void MWReport    (char *, long);
  55. void MWLimit     (LONG, LONG);
  56. void *MWrealloc  (void *, long, char *, long);
  57.  
  58. extern unsigned long  __MWFlags;
  59. extern char *__MWLogName;
  60.  
  61. #else /* MWDEBUG */
  62.  
  63. /* No memory debugging - make everything go away */
  64.  
  65. #define MWInit(a,b,c)
  66. #define MWTerm()
  67. #define MWCheck()
  68. #define MWReport(a,b)
  69. #define MWLimit(a,b)
  70.  
  71. #endif /* MWDEBUG */
  72. #endif /* D_MEMWATCH_H */
  73.